package com.zhentao.controller;

import com.zhentao.domain.YdAccountHead;
import com.zhentao.domain.dto.AllDto;
import com.zhentao.domain.dto.StatusDto;
import com.zhentao.service.*;
import com.zhentao.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class AccountHeadController {

    @Autowired
    private YdAccountHeadService accountHeadService;

    /**
     * 分页累表展示收入单据
     * @param allDto
     * @return
     */
    @RequestMapping(value = "/accountHead/accountList", method = RequestMethod.POST)
    private Result accountList(@RequestBody AllDto allDto){
        return accountHeadService.accountList(allDto);
    }

    /**
     * 查看
     * @param id
     * @return
     */
    @RequestMapping(value = "/accountHead/accountSelectOne",method = RequestMethod.POST)
    private Result accountSelectOne(@RequestParam Integer id){
        return accountHeadService.accountSelectOne(id);
    }

    /**
     * 删除单条数据
     * @param id
     * @return
     */
    @RequestMapping(value = "/accountHead/accountDelete",method = RequestMethod.DELETE)
    private Result accountDelete(@RequestParam Integer id){
        return accountHeadService.AccountHeadDel(id);
    }

    /**
     * 审核
     * @param statusDto
     * @return
     */
    @RequestMapping(value = "/accountHead/accountStatus",method = RequestMethod.POST)
    private Result accountStatus(@RequestBody StatusDto statusDto){
        return accountHeadService.AccountHeadStatus(statusDto);
    }

    /**
     * 收入账户列表展示（下拉选择）
     */
    @Autowired
    private YdAccountService accountService;
    @RequestMapping(value = "/accountHead/accountList",method = RequestMethod.GET)
    private Result accountList(){
        return accountService.AccountList();
    }

    /**
     * 机构列表展示（往来单位）下拉选项
     */
    @Autowired
    private YdOrganizationService ydOrganizationService;
    @RequestMapping(value = "/accountHead/organizationList",method = RequestMethod.GET)
    private Result organizationList(){
        return ydOrganizationService.organizationList();
    }
    /**
     * 财务人员（经手人）下拉选项
     */
    @Autowired
    private YdPersonService ydPersonService;
    @RequestMapping(value = "/accountHead/personList",method = RequestMethod.GET)
    private Result personList(){
        return ydPersonService.personList();
    }
    /**
     * 操作人员（下拉选项）
     */
    @Autowired
    private YdUserService ydUserService;
    @RequestMapping(value = "/accountHead/userList",method = RequestMethod.GET)
    private Result userList(){
        return ydUserService.userList();
    }

    /**
     * 操作/修改
     */
    @RequestMapping(value = "/accountHead/accountHeadSaveOrUpd",method = RequestMethod.POST)
    private Result saveOrUpd(@RequestBody YdAccountHead ydAccountHead){
        return accountHeadService.AccountHeadSave(ydAccountHead);
    }
    /**
     * 批量删除操作
     */
    @RequestMapping(value = "/accountHead/accountHeadDels",method = RequestMethod.DELETE)
    private Result accountHeadDels(@RequestBody Integer[] ids){
        return accountHeadService.AccountHeadDels(ids);
    }
}
